import apiRequest from "../apiIndex";

//Home
export const requestInterlockListData = () => apiRequest.get('/product/getBaseCategoryList')

//Search
export const reqSearchListData = (value = {}) => apiRequest({ url: '/list', data: value, method: "post" })

export const reqDetailListData = (skuId: number) => apiRequest({ url: `item/${skuId}`, method: 'get' })

export const reqPushMark = (skuId: number, skuNum: number) => apiRequest({ url: `/cart/addToCart/${skuId}/${skuNum}`, method: 'post' })

export const reqTradMark = () => apiRequest.get('/cart/cartList')

export const reqSendCode = (phone: number) => apiRequest.get(`/user/passport/sendCode/${phone}`)

export const reqRegister = (data: { phone: number, password: string, code: number }) => apiRequest({ url: '/user/passport/register', method: 'post', data })

export const reqLogin = (data: { phone: number, password: string }) => apiRequest({ url: '/user/passport/login', method: 'post', data })

export const reqUserData = () => apiRequest.get('/user/userAddress/auth/findUserAddressList')

export const reqQuitLogin = () => apiRequest.get('/user/passport/logout')

export const reqIsCheck = (skuID: number, isChecked: number) => apiRequest.get(`/cart/checkCart/${skuID}/${isChecked}`)

export const reqDelSomeGoods = (skuId: number) => apiRequest.delete(`/cart/deleteCart/${skuId}`)

export const reqUserAddress = () => apiRequest.get('/user/userAddress/auth/findUserAddressList')

export const reqPlyData = () => apiRequest.get('/order/auth/trade')

export const reqPayOrder = (page: number, limit: number) => apiRequest.get(`/order/auth/${page}/${limit}`)

export const reqSumbetPay = (tradeNo: string, data: { consignee: string, consigneeTel: number, deliveryAddress: string, paymentWay: 'ONLINE', orderComment: string, orderDetailList: any[] }) => apiRequest({
    url: `order/auth/submitOrder?tradeNo=${tradeNo}`,
    method: 'post',
    data
})

export const reqWechatPay = (orderId: number) => apiRequest.get(`/payment/weixin/createNative/${orderId}`)

export const reqHavePay = (orderId: number) => apiRequest.get(`payment/weixin/queryPayStatus/${orderId}`)